package top.lyjwn.todo.common.lang;

import top.lyjwn.todo.common.template.R;

public class TodoException extends RuntimeException {

    private R r;

    public TodoException(R r) {
        this.r = r;
    }


    public static TodoException SUCCESS(String msg) {
        return new TodoException(R.init().ok(msg));
    }

    public static TodoException FAIL(Integer code, String msg) {
        return new TodoException(R.init().error(code, msg));
    }

    public R getR() {
        return r;
    }

    @Override
    public String getMessage() {
        return r.getMsg();
    }
}
